const apiEnv: ApiEnv = "prod";

const envMap = {
  dev: {
    apiBaseUrl: "https://rwapitest.cheeseword.com",
  },
  beta: {
    apiBaseUrl: "https://rwapitest.cheeseword.com",
  },
  prod: {
    apiBaseUrl: "https://rwapi.cheeseword.com",
  }
};

const prefixUrl = "https://rwstatic.tentons.cn/" // 图片等前缀

type ApiEnv = keyof typeof envMap;
type Env<T extends ApiEnv> = {
  apiEnv: T;
} & (typeof envMap)[T];

function createEnv(apiEnv: ApiEnv): Env<typeof apiEnv> {
  return Object.assign({ apiEnv }, envMap[apiEnv]);
}

const env = Object.assign(createEnv(apiEnv), { prefixUrl });

export default env;
